import _request from "../../common/_request";
import {Message} from "element-ui";

let lib_result_car = {

    module : 'result.car',

    //查询项目列表
    select : function (search_where, callback){
        let data = typeof search_where === "function" ? search_where() : {};
        let params = _request._params(this.module, 'select', data);
        _request._post(params, function(response){
            if (response.code !== _request.success) {
                Message.info(response.msg);
                return;
            }

            //回调数据
            callback(response.data)
        }, 0);
    },

    //查询项目列表
    select_brand : function (search_where, callback){
        let data = typeof search_where === "function" ? search_where() : {};
        let params = _request._params(this.module, 'select_brand', data);
        _request._post(params, function(response){
            if (response.code !== _request.success) {
                Message.info(response.msg);
                return;
            }

            //回调数据
            callback(response.data)
        }, 0);
    },

    //查询项目列表
    select_series : function (brandId, brandName, search_where, callback){
        let data = typeof search_where === "function" ? search_where() : {};
        data.brandId = brandId
        data.brandName = brandName
        let params = _request._params(this.module, 'select_series', data);
        _request._post(params, function(response){
            if (response.code !== _request.success) {
                Message.info(response.msg);
                return;
            }

            //回调数据
            callback(response.data)
        }, 0);
    },

    //查询项目列表
    list : function (callback){
        let data = {}
        let params = _request._params(this.module, 'list', data);
        _request._post(params, function(response){
            if (response.code !== _request.success) {
                Message.info(response.msg);
                return;
            }

            //回调数据
            callback(response.data)
        }, 0);
    },


}

export default lib_result_car
